#include<bits/stdc++.h>
using namespace std;
int main () {
    int Pa, Pb;
    cin >> Pa >> Pb;
    int a, b, c;
    cin >> a >> b >> c;
    if (Pa > Pb) {
        if (a + b + c == 3) cout << "The winner is b: " << Pb << " + " << a + b + c << endl;
        else cout << "The winner is a: " << Pa << " + " << 3 - (a + b + c) << endl;
    } else {
        if (a + b + c == 0) cout << "The winner is a: " << Pa << " + " << 3 - (a + b + c) << endl;
        else cout << "The winner is b: " << Pb << " + " << a + b + c << endl;
    }
    
    return 0;
}
